<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>科研项目列表</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-4">
    <h1>科研项目列表</h1>
    <div class="row mb-3">
        <div class="col-md-6">
            <a th:href="@{/researches/add}" class="btn btn-primary">添加科研项目</a>
            <a th:href="@{/researches/stats}" class="btn btn-secondary ml-2">统计查询</a>
        </div>
        <div class="col-md-6">
            <form th:action="@{/researches/search}" method="get" class="form-inline float-right">
                <input type="text" name="keyword" class="form-control mr-2" placeholder="搜索...">
                <button type="submit" class="btn btn-outline-success">搜索</button>
            </form>
        </div>
    </div>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>ID</th>
            <th>标题</th>
            <th>教师</th>
            <th>类型</th>
            <th>发布日期</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="research : ${researches}">
            <td th:text="${research.researchId}"></td>
            <td th:text="${research.title}"></td>
            <td th:text="${research.teacher.name}"></td>
            <td th:text="${research.researchType.typeName}"></td>
            <td th:text="${#dates.format(research.publishDate, 'yyyy-MM-dd')}"></td>
            <td th:text="${research.status}"></td>
            <td>
                <a th:href="@{/researches/edit/{id}(id=${research.researchId})}" class="btn btn-sm btn-info">编辑</a>
                <a th:href="@{/researches/delete/{id}(id=${research.researchId})}" class="btn btn-sm btn-danger" onclick="return confirm('确定删除吗？')">删除</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>